import axios from 'axios';

const request = axios.create({
  baseURL: "",
  timeout: 5000,
});

// 请求拦截器
request.interceptors.request.use(config => {
  config.headers.tonken = '111111111111111111111111'
  return config
}, (err) => {
  return Promise.reject(err)
})

// 响应拦截器
request.interceptors.response.use(response => {
  const {status} = response
  switch (status) {
    case 201:
      console.log(201);
      break;
    case 404:
      console.log(404);
      break;
    default:
      console.log('moren')
      break;
  }
  return response
}, (err) => {
  return Promise.reject(err)
})

export default request
